<%@ page import="com.lsk.util.GlobalParameter" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/17 0017
  Time: 上午 8:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>

<head>
    <title>微信支付</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%--<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">--%>
    <meta name="format-detection" content="telephone=yes"/>
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <script src="my/js/jquery-3.3.1.min.js"></script>
    <script src="/js/cookie/jquery.cookie.js"></script>
</head>
<body>
<%--<input type="hidden" id="appId" value="${h5map.appId}">--%>
<%--<input type="hidden" id="timeStamp" value="${h5map.timeStamp}">--%>
<%--<input type="hidden" id="nonceStr" value="${h5map.nonceStr}">--%>
<%--<input type="hidden" id="package1" value="${h5map.package1}">--%>
<%--<input type="hidden" id="paySign" value="${h5map.paySign}">--%>
<script>
    function onBridgeReady(){
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId":"${h5Map.appId}",     //公众号名称，由商户传入
                "timeStamp":"${h5Map.timeStamp}",         //时间戳，自1970年以来的秒数
                "nonceStr":"${h5Map.nonceStr}", //随机串
                "package":"${h5Map.package1}",
                "signType":"MD5",         //微信签名方式：
                "paySign":"${h5Map.paySign}" //微信签名
            },
            function(res){
//                 alert(res.err_code);
//                 alert(res.err_desc);
//                 alert(res.err_msg);

                if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                    $.cookie("payIdentification${h5Map.memberId}","1");
                    location.href = "/mobileGroup/groupIndex?orgId=${h5Map.orgId}&activityId=${h5Map.activityId}&parentId=${h5Map.memberId}&groupId=${h5Map.groupId}&timestamp=<%=GlobalParameter.timestamp%>";//页面回调地址
                }     // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
            }
        );
    }
    if (typeof WeixinJSBridge == "undefined"){
        if( document.addEventListener ){
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        }else if (document.attachEvent){
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    }else{
        onBridgeReady();
    }
</script>
</body>
</html>
